package com.shawn.server.controller;

import com.shawn.model.vo.SoundVo;
import com.shawn.model.vo.VideoVo;
import com.shawn.server.service.PeachBlossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author shawn
 * @date 2022年 11月 11日 19:40
 */

@RestController
@RequestMapping("/peachblossom")
public class PeachBlossomController {

    @Autowired
    private PeachBlossomService blossomService;

    /**
     * 发送声音
     *
     * @param soundFile 声音文件
     * @return {@link ResponseEntity}
     * @throws IOException ioexception
     */
    @PostMapping
    public ResponseEntity flowVoice(MultipartFile soundFile) throws IOException {
        return blossomService.flowVoice(soundFile);
    }

    /**
     * 获取语音
     *
     * @return {@link ResponseEntity}
     * @throws IOException ioexception
     */
    @GetMapping
    public ResponseEntity getVoice() throws IOException {
        SoundVo soundVo = blossomService.getVoice();
        return ResponseEntity.ok(soundVo);
    }


}
